Repository navigation
Conversation
`tagged_code_units` used the source memory's tag, but `store_string_into_range` decoded it with the target memory's tag, so passing strings between 32- and 64-bit memories checked the wrong tag and this was guest-observable due to the wrong `realloc` calls getting made. This is fixed by having `load_string_from_range` eagerly decode and remember the `String`'s encoding hint and `store_string_into_range` to just use that hint, rather than try to read the hint itself. Additionally, I made a `class StringHint(Enum)` so that it is more clear what the hint cases are, and to differentiate dynamic hints from actual encodings and the `string-encoding` canon option values.
|
(Responding to this comment over here in the PR thread, where I think it makes sense to discuss specifics of the proposed ABI, now that it exists as a proper PR instead of an issue comment.)
It is already the case today, with the linear memory ABI, that adding or removing a
To make sure I understand, you're suggesting that
Is that correct? How does one do I guess if there was a single common supertype for all the block (result (ref i31))
...
local.get $my-variant
;; Check for payload-free `case`s.
br_on_cast (ref i31) 0
;; Handle `case`s with payloads.
block
block
...
block
local.get $my-variant
ref.cast $my-variant-with-payload-supertype
struct.get $my-variant-with-payload-supertype $discriminant
br_table ...
end
...
end
...
end
...
unreachable
end
;; Handle payload-free cases
block
block
...
block
local.get $my-variant
ref.cast (ref i31)
br_table ...
end
...
end
...
end
...And while I admit that will give Alternatively, if we wanted to statically choose a representation statically at compile-time between something like
then we could achieve a Yet another alternative is to remove the no- |
|
We don't need to actually allocate anything for the cases without payload, even when they are represented as structs. They are statically known singletons; they can be allocated once and for all (well, once per component, since it doesn't know about the other ones). For enums, I agree a simple integer is still better. Either way to me using |
Unfortunately, it isn't something orthogonal that we can discuss or special-case separately because the component model defines
That's a good point that the toolchain can pre-allocate or hashcons But this actually raises an issue with the PR's current state: it specs allocating new objects during lowering (e.g. invoking |
|
Can we spec it as intentionally unspecified whether we reallocate? Like we do for NaN's? |
|
Just on this point:
"Specializations" aren't quite syntactic sugar: they're treated as distinct type constructors (not type-equal to what they are a specialization of) and in some cases are given distinct ABIs (viz., |
Fixes #525
Depends on #772